<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>网站信息</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<button id="web" class="btn btn-default" type="submit" onclick="getWebsite()">点击获取网站地址 (跨域请求后端接口)</button>
</body>
<script type="text/javascript">
    function getWebsite() {
        $.ajax({
            type: 'get',
            url: "http://localhost:81/website",
            data: {},
            success: function (res) {
                $('#web').text(res.url);
                $('#web').attr('disabled',true);
            },
            error: function (err) {
                alert('跨域请求失败')
            }
        })
    }
</script>

</html>
